/*
Gautam Nair	
Proposal title: Misperceptions of the Global Income Distribution and Preferences for Cross-National Redistribution in the United States


HYPOTHESES

Stated-Hyp1: "Individuals in advanced industrial countries such as the United States systematically misperceive their position in the distribution of income. More specifically, individuals on average tend to underestimate their rank" (p. 13)
	
	// NOTE: to test this we need percieved decile (which we have) + true global income decile. We don't know where to find the global income distribution that is needed for comparison. Cannot be tested.

Stated-Hyp2: "Individuals in advanced industrial countries such as the United States systematically misperceive their position in the distribution of income. More specifically, individuals on average tend... overestimate the global median income." (p. 13)
	
	Test-Hyp1: Percieved global median income will be higher than actual global median income.	

	
Stated-Hyp2: "providing individuals with accurate information about their rank and the global median income will increase individuals’ support for foreign aid and other kinds of cross-national redistribution." (p. 13)	
	// see outcomes on p. 7-8. see notes about including covariates.

	Test-Hyp2: Support for non-military economic aid will be higher in the treatment group vs. control group, conditional on covariates.
	
	
	Test-Hyp3: Recommended share of federal budget for foreign economic aid will be higher in the treatment group vs. control group, conditional on covariates.	
	
	Test-Hyp4: Support for reducing protective trade policies (import taxes/subsidies) will be higher in the treatment group vs. control group, conditional on covariates.	
	
	Test-Hyp5: Share of bonus donated to foreign aid will be higher in the treatment group vs. control group. [if bonus was actually awarded] conditional on covariates.	

	Test-Hyp6: Share of bonus donated to foreign aid will be higher in the treatment group vs. control group. [bonus not awarded; hypothetical question] conditional on covariates.		
	
	
Stated-Hyp3: "The study will also examine how treatment effects interact with inequity aversion, beliefs about the role of luck and effort, cosmopolitanism." [p. 8]
	// NOTE: all these variables are also listed as covariates in the regressions [p. 18]. In the heterogeneous TE estimations, we are not including any covariates because they are not specified. 

	Test-Hyp7: Treatment effect on Support for non-military economic aid will be moderated by inequality aversion.
	
	Test-Hyp8:  Treatment effect on federal budget for foreign economic aid will be moderated by inequality aversion.
	
	Test-Hyp9:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by inequality aversion.
	
	Test-Hyp10:  Treatment effect on Share of bonus donated to foreign aid will be moderated by inequality aversion. [if bonus was actually awarded]	

	Test-Hyp11:  Treatment effect on Share of bonus donated to foreign aid will be moderated by inequality aversion.. [bonus not awarded; hypothetical question]	

	
	Test-Hyp12: Treatment effect on Support for non-military economic aid will be moderated by beliefs about the role of luck and effort
	
	Test-Hyp13:  Treatment effect on federal budget for foreign economic aid will be moderated by beliefs about the role of luck and effort
	
	Test-Hyp14:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by beliefs about the role of luck and effort.
	
	Test-Hyp15:  Treatment effect on Share of bonus donated to foreign aid will be moderated by beliefs about the role of luck and effort. [if bonus was actually awarded]	

	Test-Hyp16:  Treatment effect on Share of bonus donated to foreign aid will be moderated by beliefs about the role of luck and effort. [bonus not awarded; hypothetical question]		
	
	
	
	Test-Hyp17: Treatment effect on Support for non-military economic aid will be moderated by cosmopolitanism.
	
	Test-Hyp18:  Treatment effect on federal budget for foreign economic aid will be moderated by cosmopolitanism.
	
	Test-Hyp19:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by cosmopolitanism.
	
	Test-Hyp20:  Treatment effect on Share of bonus donated to foreign aid will be moderated by cosmopolitanism. [if bonus was actually awarded]	

	Test-Hyp21:  Treatment effect on Share of bonus donated to foreign aid will be moderated by cosmopolitanism. [bonus not awarded; hypothetical question]			
	
********************************************************************************
NOTES
- We cannot test stated hypothesis 1 because we don't know how/where to find the global income distribution.
- For stated hypothesis 2, overestimation is defined by the author as follows: 'They will be coded as overestimating the global median income if they estimate it at more than $3,000' (p. 13). So a one-sided t-test should be use used to test if perceived median income is >3000.
- In meeting on 4-30-2021, we decided to test this as whether >50% of the sample over-estimates the global median.

- Analysis plan for stated hypothesis 2 includes covariates (p. 8, 14, 18) + robust standard errors. 
- Analysis plan mentions using logistic regressions for dichotomous variables. 

- In the fielded experiment, there are treatment conditions testing the same treatment as proposed w.r.t. US income distribution (the proposed treatment was only about the global distribution). There is no hypothesis about the US distribution, so we are ignoring those treatment arms. Also, fielded experiment has 5 treatment arms (proposal had 4).

- There are 2 control groups. One pure control that is not asked/provided any information about global income rank. The second control group is asked about global rank but is not corrected. The second control seems more relevant to the hypothesis (i.e. if we want to know the effect of providing correct information, we would not want to confound it with the effect of asking about rank). We are using the second control in all tests.

- Question about protective trade policies was proposed as a dichotmous question and author planned to analyze it as logit. Fielded question has 4 outcomes. 

- The appendix also has some additional hypotheses about moderation by 4 more variables listed as covariates (p. 14). This will add 20 additional hypotheses (4 x 5 outcomes). Since these hypotheses are not mentioned anywhere in the proposal, we are not including them in the analysis.

*/

clear all
use "Nair644.dta", clear

********************************************************************************

* INDICATORS OF EXPERIMENTAL MANIPULATIONS

* Treatment group: correct income information shown; control group not shown correction

	tab XTESS186
	recode XTESS186 (1=.c "pure control") (2=1 "1 control: global r asked") (3=2 "2 treat: global r asked +corrected") (*=.), gen(treatment)
	tab treatment	

	
* OUTCOME MEASURES

	* percieved rank in global distribution
		tab Q3A
		replace Q3A=. if Q3A<1
		egen percievedrank = cut(Q3A), at(1,11,21,31,41,51,61,71,81,91,101)
		tab percievedrank
		recode percievedrank (1=1) (11=2) (21=3) (31=4) (41=5) (51=6) (61=7) (71=8) (81=9) (91=10), gen(decile_percieved)
		tab decile_percieved
		
	* percieved global median income
		tab Q3B
		replace Q3B=. if Q3B==-1 // recode missing
		gen globalmedian_percieved= Q3B
		
	* is percieved global median over-estimated?	
	// NOTE: 'They will be coded as overestimating the global median income if they estimate it at more than $3,000' (p. 13)
		gen globalmedian_overest=1 if globalmedian_percieved>3000 & globalmedian_percieved!=.
		replace globalmedian_overest=0 if globalmedian_percieved<=3000
	
	* support for non-military aid	

		/* Q8. About 1% of the US Federal Budget is spent on nonmilitary economic 
		aid to foreign countries. Would you say that the US now spends too much, too
		little, or about the right amount? */
		
		// proposal p.11 mentions plans to dichotomize; but fielded question differs from proposed and has more response categories. Treating as continuous
		tab Q8
		replace Q8=. if Q8==-1 // recode missing
		clonevar aid_givemore= Q8

	* Recommended share of federal budget	
		tab Q9
		replace Q9=. if Q9==-1 // recode missing
		clonevar budgetsharegive= Q9
		
	* support for reducing protective trade policies (import taxes/subsidies)
		// see notes
		replace Q11=. if Q11==-1
		tab Q11
		clonevar freetradesupport=Q11
		
	* Share of bonus donated to foreign aid 

		*if bonus was actually awarded
		tab Q13A_3  
		replace Q13A_3=. if Q13A_3==-1
		gen donate_foreignaid_actual=Q13A_3
		
		*bonus not awarded; hypothetical question		
		tab Q13B_3
		replace Q13B_3=. if Q13B_3==-1	
		gen donate_foreignaid_hypothetical=Q13B_3	
	


* COVARIATES (p. 19)

	* Liberal Ideology (1 if Extremely Liberal, Liberal, Slightly Liberal; 0 otherwise)
		tab IDEO_New
		recode IDEO_New (-1=.) (1/3=1) (4/7=0), gen(liberalideo)
		tab liberalideo
		
	* Party ID (1 if Democrat; 0 otherwise)
		tab XPARTY7_New
		recode XPARTY7_New (5/7=1) (1/4=0), gen(democrat)

	* Education (1 if >= Associate degree; 0 otherwise)
		tab PPEDUC, nol
		recode PPEDUC (1/10=0) (11/14=1), gen(education)

	* Household Income ($5,000 increments, top coded at $175,000)
		tab Income , nol
		replace Income=. if Income==-1|Income==20 // recode missing

	* Gender (1 if Female, 0 otherwise)
		tab PPGENDER

	* Religion (1 if attends services >= once or twice a month; 0 otherwise)
		tab REL2_New 
		recode REL2_New (-1=.) (1/3=1) (4/6=0), gen(religious)

	* Inequality Aversion (1 if “Incomes should be made more equal”; 0 otherwise)
		/* this question was changed to:
		Q10. Some people think that the government in Washington ought to reduce the 
		income differences between the rich and the poor in the United States, perhaps 
		by raising the taxes of wealthy families or by giving income assistance to 
		the poor. Others think that the government should not concern itself with 
		reducing this income difference between the rich and the poor. Think of a 
		score of 1 as meaning that the government ought to reduce the income 
		differences between rich and poor, and a score of 7 meaning that the 
		government should not concern itself with reducing income differences. 
		What score between 1 and 7 comes closest to the way you feel? 
		*/
		tab Q10
		replace Q10=. if Q10==-1
		gen inequalityaversaion=8-Q10 // reverse coding

	* Luck vs. Effort (0 if “In the long run, hard work usually brings success in life”; 1 otherwise)
		tab Q1
		recode Q1 (-1=.) (1=1) (2/3=0), gen(hardwork_success)
		tab hardwork_success

	* Cosmopolitan World View (“I see myself as a world citizen”)
		tab Q2_3 
		replace Q2_3=. if Q2_3==-1
		clonevar cosmopolitanism=Q2_3

	* Altruism (1 if donated to charity based on response to pppa0089; 0 otherwise)
		tab ppp10089
		clonevar altruism=ppp10089

* MODERATORS
	* income above median
	// us median in 2015 was 56,500; recoding over 60k as over median
	recode Income (13/19=1) (1/12=0), gen(highincome)
	
********************************************************************************

* ANALYSIS
	
*	Test-Hyp1: Percieved global median income will be lower than actual global median income.	
	// NOTE: 'They will be coded as overestimating the global median income if they estimate it at more than $3,000' (p. 13)
	
	ttest globalmedian_percieved == 3000
	//  reject. Pr(T > t) = 0.0538
	tess +, ttest init(Nair644)
	
* 	Test-Hyp2: Support for non-military economic aid will be higher in the treatment group vs. control group.

	reg aid_givemore i.treatment ///
	i.liberalideo i.democrat i.PPGENDER i.religious i.hardwork_success cosmopolitanism i.altruism inequalityaversaion, vce(robust)
	// reject. 0.654
	tess 2.treatment +, bonf(5)

*	Test-Hyp3: Recommended share of federal budget for foreign economic aid will be higher in the treatment group vs. control group, conditional on covariates.	
	reg budgetsharegive i.treatment ///
	i.liberalideo i.democrat i.PPGENDER i.religious i.hardwork_success cosmopolitanism i.altruism inequalityaversaion, vce(robust)
	// reject. 0.200	
	tess 2.treatment +, bonf(5)	
	
*	Test-Hyp4: Support for reducing protective trade policies (import taxes/subsidies) will be higher in the treatment group vs. control group, conditional on covariates.	
	ologit freetradesupport i.treatment ///
	i.liberalideo i.democrat i.PPGENDER i.religious i.hardwork_success cosmopolitanism i.altruism inequalityaversaion, vce(robust)
	// reject. 0.355
	tess 2.treatment +, bonf(5)
	
*	Test-Hyp5: Share of bonus donated to foreign aid will be higher in the treatment group vs. control group. [if bonus was actually awarded] conditional on covariates.	
	reg donate_foreignaid_actual i.treatment ///
	i.liberalideo i.democrat i.PPGENDER i.religious i.hardwork_success cosmopolitanism i.altruism inequalityaversaion, vce(robust)
	// do not reject.0.002
	tess 2.treatment +, bonf(5)

*	Test-Hyp6: Share of bonus donated to foreign aid will be higher in the treatment group vs. control group. [bonus not awarded; hypothetical question] conditional on covariates.		
	reg donate_foreignaid_hypothetical i.treatment ///
	i.liberalideo i.democrat i.PPGENDER i.religious i.hardwork_success cosmopolitanism i.altruism inequalityaversaion, vce(robust)
	// reject. 0.420
	tess 2.treatment +, bonf(5)	
	
*	Test-Hyp7: Treatment effect on Support for non-military economic aid will be moderated by inequality aversion.
	reg aid_givemore i.treatment##c.inequalityaversaion
	// reject. 0.339
	tess 2.treatment#c.inequalityaversaion, bonf(5)	
	
*	Test-Hyp8:  Treatment effect on federal budget for foreign economic aid will be moderated by inequality aversion.
	reg budgetsharegive i.treatment##c.inequalityaversaion
	// reject. 0.497
	tess 2.treatment#c.inequalityaversaion, bonf(5)	
	
*	Test-Hyp9:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by inequality aversion.
	ologit freetradesupport  i.treatment##c.inequalityaversaion
	// reject. 0.940
	tess 2.treatment#c.inequalityaversaion, bonf(5)	
	
*	Test-Hyp10:  Treatment effect on Share of bonus donated to foreign aid will be moderated by inequality aversion. [if bonus was actually awarded]	
	reg donate_foreignaid_actual i.treatment##c.inequalityaversaion
	// reject. 0.568
	tess 2.treatment#c.inequalityaversaion, bonf(5)	
	
*	Test-Hyp11:  Treatment effect on Share of bonus donated to foreign aid will be moderated by inequality aversion.. [bonus not awarded; hypothetical question]	
	reg donate_foreignaid_hypothetical i.treatment##c.inequalityaversaion
	// reject. 0.139
	tess 2.treatment#c.inequalityaversaion, bonf(5)	
	
	
	
*	Test-Hyp12: Treatment effect on Support for non-military economic aid will be moderated by beliefs about the role of luck and effort
	reg aid_givemore i.treatment##i.hardwork_success
	// reject. 0.219	
	tess 2.treatment#1.hardwork_success, bonf(5)	
	
*	Test-Hyp13:  Treatment effect on federal budget for foreign economic aid will be moderated by beliefs about the role of luck and effort
	reg budgetsharegive i.treatment##i.hardwork_success
	// reject .744
	tess 2.treatment#1.hardwork_success, bonf(5)
	
*	Test-Hyp14:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by beliefs about the role of luck and effort.
	ologit freetradesupport i.treatment##i.hardwork_success
	// reject. 0.955
	tess 2.treatment#1.hardwork_success, bonf(5)
	
*	Test-Hyp15:  Treatment effect on Share of bonus donated to foreign aid will be moderated by beliefs about the role of luck and effort. [if bonus was actually awarded]	
	reg donate_foreignaid_actual i.treatment##i.hardwork_success
	// reject .957
	tess 2.treatment#1.hardwork_success, bonf(5)
	
*	Test-Hyp16:  Treatment effect on Share of bonus donated to foreign aid will be moderated by beliefs about the role of luck and effort. [bonus not awarded; hypothetical question]		
	reg donate_foreignaid_hypothetical i.treatment##i.hardwork_success
	// reject .791
	tess 2.treatment#1.hardwork_success, bonf(5)	
	

	
	
*	Test-Hyp17: Treatment effect on Support for non-military economic aid will be moderated by cosmopolitanism.
	reg aid_givemore i.treatment##c.cosmopolitanism
	// reject .258
	tess 2.treatment#c.cosmopolitanism, bonf(3)
	
*	Test-Hyp18:  Treatment effect on federal budget for foreign economic aid will be moderated by cosmopolitanism.
	reg budgetsharegive i.treatment##c.cosmopolitanism
	// reject .181
	tess 2.treatment#c.cosmopolitanism, bonf(3)
	
*	Test-Hyp19:  Treatment effect on Support for reducing protective trade policies (import taxes/subsidies) will be moderated by cosmopolitanism.
	reg freetradesupport i.treatment##c.cosmopolitanism
	// reject. 0.126
	tess 2.treatment#c.cosmopolitanism, bonf(3)	
	
*	Test-Hyp20:  Treatment effect on Share of bonus donated to foreign aid will be moderated by cosmopolitanism. [if bonus was actually awarded]	
	reg donate_foreignaid_actual i.treatment##c.cosmopolitanism
	// reject .668
	tess 2.treatment#c.cosmopolitanism, bonf(1)
	// bonf=1 because only a sub-sample got bonus
	
*	Test-Hyp21:  Treatment effect on Share of bonus donated to foreign aid will be moderated by cosmopolitanism. [bonus not awarded; hypothetical question]			
	reg donate_foreignaid_hypothetical i.treatment##c.cosmopolitanism	
	// reject .394
	tess 2.treatment#c.cosmopolitanism, bonf(1)
	// bonf=1 because only a sub-sample did not get bonus
		